<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<%=basePath %>/resource/js/common-css-js.js" charset="UTF-8"></script>
<link type="text/css" rel="stylesheet" href="<%=basePath %>/resource/css/step.css" charset="UTF-8"></link>
<title>仓库管理-入库-添加</title>
<style type="text/css">
	
	.step-header-wrap {
		padding-left: 0px;
	}
	
	.step-bar {
	
		position: relative;
	    left: 50%;
	    transform: translateX(-50%)
	    
	}
	.step-header>ul {
	
		position: relative;
	    left: 45%;
	    transform: translateX(-37%);
	}
	
	.table-white-space {/*表格内文字强制一行显示*/
		overflow-x: scroll;
	    text-overflow: clip;
	    white-space: nowrap;
	}
	
</style>
</head>
<body>
	<div id="step" class="step-body">
		<i id="preBtn" class="layui-icon stepBtn">&#xe603;</i>
		<i id="nextBtn" class="layui-icon stepBtn">&#xe602;</i>
	    <div class="step-header step-header-wrap">
	        <ul>
	            <li>
	                <span class="step-name">基本信息填写</span>
	            </li>
	            <li>
	                <span class="step-name">货物信息填写</span>
	            </li>
	            <li>
	                <span class="step-name">确认提交</span>
	            </li>
	        </ul>
	    </div>
		<div class="step-content">
	       	<div class="step-list">
		       	<div class="panel-body" style="padding-bottom:0px;">
					  <form id="pageOneForm" class="layui-form">
						  <div class="layui-form-item">
						      <input type="text" name="stockInExecutor" lay-verify="required|peopleName" placeholder="执行人员" autocomplete="off" class="layui-input">
						  </div>
						  <div class="layui-form-item">
						   <select name="stockInStatus" lay-verify="required">
					        <option value="等待入库">等待入库</option>
					        <option value="入库中">入库中</option>
					        <option value="入库完成">入库完成</option>
					       </select>
					      </div>
						  <div class="layui-form-item">
						      <textarea name="stockInRemark" placeholder="备注" class="layui-textarea"></textarea>
						  </div>
					</form>
				</div>
	       	</div>
	       	<div class="step-list">
	       		<%@include file="/admin/commonsPage/table.html" %>
	       	</div>
	       	<div class="step-list">
	       		<div class="layui-row">
					<div class="layui-col-lg6 layui-col-md6 layui-col-xs6 layui-col-sm6">
						<blockquote class="layui-elem-quote title">系统基本参数</blockquote>
						<table class="layui-table magt0">
							<colgroup>
								<col width="150">
							</colgroup>
							<tbody id="baseInfoTable">
								<tr>
									<td>执行人员</td>
									<td name="stockInExecutor"></td>
								</tr>
								<tr>
									<td>入库状态</td>
									<td name="stockInStatus"></td>
								</tr>
								<tr>
									<td>备注</td>
									<td name="stockInRemark"></td>
								</tr>
							</tbody>
						 </table>
						 <blockquote style="margin-top: 10px;" class="layui-elem-quote title">系统基本参数</blockquote>
						 <table class="layui-table magt0">
							<colgroup>
								<col width="150">
							</colgroup>
							<tbody>
								<tr>
									<td>操作</td>
									<td><input id="submitBtn" class="layui-btn layui-btn-primary" type="button" value="添加入库"></td>
								</tr>
							</tbody>
						 </table>
					</div>
					<div class="table-white-space layui-col-lg6 layui-col-md6 layui-col-xs6 layui-col-sm6">
						<blockquote class="layui-elem-quote title">货物信息</blockquote>
						<table class="layui-table">
						  <colgroup>
							   <col width="90">
							   <col width="90">
							   <col width="90">
							   <col width="90">
							   <col width="90">
						  </colgroup>
						  <thead>
						    <tr>
						      <th>货物名称</th>
						      <th>货物数量</th>
						      <th>货物单位</th>
						      <th>货物分类</th>
						      <th>所属货架</th>
						    </tr> 
						  </thead>
						  <tbody id="goodsTable">
						  </tbody>
						</table>
					</div>
				</div>
	       	</div>
        </div>
	</div>
	<script type="text/javascript" src="<%=basePath %>/admin/enterpriseManagement/repositoryManagement/stockIn/common-add-update.js"></script>
	<script type="text/javascript" src="<%=basePath %>/resource/jquery-serializeObject/jquery.serializeObject.js"></script>
	<script type="text/javascript">
		$("#submitBtn").on('click',function(){
			
			//数组
			goodsData = cTable.bootstrapTable('getData');
			
			//对象
			baseInfoData = $('#pageOneForm').serializeObject();
			
			//字符窜拼接
			var object = $.extend({"array":goodsData},{"obj":baseInfoData});
			
			$.ajax({
			   type: 'POST',
			   url: path+"/repository/stock-in",
			   data: JSON.stringify(object),
			   contentType: "application/json;charset='UTF-8'",
			   statusCode: {
				   201: function() {
					   fixedAlert("添加操作成功！",1,true);
				   },
				   412: function(){
					   fixedAlert("添加操作失败,请检查输入的值是否正确!",0,false);
				   },
				   500: function(){
					   fixedAlert("服务端繁忙！",2,false);
				   }
			   }
	       });
			
		})
	</script>
</body>
</html>